package com.summer.framework.api.feign.service.admin;

import com.summer.framework.common.constant.ServiceNameConstants;
import com.summer.framework.common.entity.Users;
import com.summer.framework.common.entity.response.BooleanResponse;
import com.summer.framework.common.exception.ParemeterException;
import com.summer.framework.common.exception.admin.UserNameExistException;
import com.summer.framework.common.exception.admin.UserNameNotFoundException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @auther: 杨杰
 * @date: 2018/11/30 21:02
 * @description:
 */
@FeignClient(value = ServiceNameConstants.SERVICE_ADMIN/*,configuration = FeignConfig.class,fallbackFactory = UserApiServiceFactory.class*/)
public interface UserApiService {

    @GetMapping("/api/user")
    List<Users> list();

    @GetMapping(value = "/api/user/getUserByName/{userName}")
    Users getUserByName(@PathVariable("userName") String userName) throws UserNameNotFoundException;

    @PostMapping(value = "/api/user")
    BooleanResponse save(@RequestBody Users user) throws ParemeterException, UserNameExistException;



}
